home *** CD-ROM | disk | FTP | other *** search
- function JCPreloaderClass()
- {
- var _loc1_ = this;
- _loc1_.orgWidth = 100;
- _loc1_.orgHeight = 20;
- _loc1_.factor = 0;
- _loc1_.proceedAt = 99;
- _loc1_.spacer = 2;
- _loc1_.init();
- }
- JCPreloaderClass.prototype = new MovieClip();
- JCPreloaderClass.prototype.init = function()
- {
- var _loc1_ = this;
- _loc1_.orgWidth = _loc1_._width;
- _loc1_.orgHeight = _loc1_._height;
- _loc1_._xscale = _loc1_._yscale = 100;
- _loc1_.boundingBox_mc._visible = false;
- _loc1_.setSize(_loc1_.orgWidth,_loc1_.orgHeight);
- _loc1_._x = parseInt(_loc1_._x);
- _loc1_._y = parseInt(_loc1_._y);
- _loc1_.txtAttrib = new TextFormat();
- _loc1_.txtAttrib.color = 0;
- _loc1_.txtAttrib.font = "_sans";
- _loc1_.txtAttrib.embedFonts = false;
- _loc1_.txtAttrib.size = _loc1_.orgHeight / 2 + 3;
- _loc1_.txtAttrib.align = "center";
- if(_loc1_.mcToPlay ne "")
- {
- _loc1_.playMC = _loc1_._parent[_loc1_.mcToPlay];
- _loc1_.playMCLength = _loc1_.playMC._totalframes;
- }
- _loc1_.onEnterFrame = function()
- {
- var _loc1_ = this;
- _loc1_.bLoaded = _loc1_._parent.getBytesLoaded();
- _loc1_.bTotal = _loc1_._parent.getBytesTotal();
- _loc1_.factor = Math.ceil(_loc1_.bLoaded / _loc1_.bTotal * 100);
- if(_loc1_.factor < _loc1_.proceedAt)
- {
- var _loc2_ = _loc1_.factor * _loc1_.playMCLength / 100;
- _loc1_.playMC.gotoAndStop(_loc2_);
- _loc1_._parent.stop();
- }
- else if(!_loc1_.thisIsThepreview)
- {
- _loc1_._parent.play();
- }
- _loc1_.redraw();
- if(_loc1_.thisIsThepreview)
- {
- _loc1_.onEnterFrame = null;
- }
- };
- };
- JCPreloaderClass.prototype.setSize = function(w, h)
- {
- var _loc1_ = this;
- _loc1_.orgWidth = w;
- _loc1_.orgHeight = h;
- _loc1_.boundingBox_mc._width = w;
- _loc1_.boundingBox_mc._height = h;
- _loc1_.redraw();
- };
- JCPreloaderClass.prototype.redraw = function()
- {
- var _loc1_ = this;
- _loc1_.setText();
- _loc1_.clear();
- if(_loc1_.showBar)
- {
- var _loc3_ = _loc1_.factor * _loc1_.orgWidth / 100;
- var _loc2_ = _loc1_.orgHeight;
- var w2 = _loc1_.orgWidth;
- _loc1_.drawRectangle(_loc1_.sp * -1,_loc1_.orgWidth + _loc1_.sp,_loc1_.sp * -1,_loc1_.orgHeight + _loc1_.sp,_loc1_.color5,_loc1_.color5,100,false);
- if(_loc1_.factor > 0)
- {
- _loc1_.drawRectangle(0,_loc3_,0,_loc2_,_loc1_.color1,_loc1_.color2,100,true);
- }
- if(_loc1_.factor < 100)
- {
- _loc1_.drawRectangle(_loc3_,w2,0,_loc2_,_loc1_.color3,_loc1_.color4,100,true);
- }
- }
- };
- JCPreloaderClass.prototype.setText = function()
- {
- var _loc1_ = this;
- if(_loc1_.thisIsThepreview)
- {
- _loc1_.factor = random(100);
- }
- if(_loc1_.showText)
- {
- if(_loc1_.factor < _loc1_.proceedAt)
- {
- _loc1_.percentloaded = _loc1_.factor + "% loaded";
- }
- else
- {
- _loc1_.percentloaded = "Loading complete!";
- }
- }
- else
- {
- _loc1_.percentloaded = "";
- }
- _loc1_.fontSize = _loc1_.orgHeight / 2 + 3;
- _loc1_.txtAttrib.size = _loc1_.fontSize;
- _loc1_.yOffsetText = _loc1_.orgHeight / 2 - _loc1_.fontSize / 2 - 2;
- _loc1_.createTextField("percentTxt",9,0,_loc1_.yOffsetText,_loc1_.orgWidth,_loc1_.orgHeight + 3);
- _loc1_.percentTxt.setNewTextFormat(_loc1_.txtAttrib);
- _loc1_.percentTxt.text = _loc1_.percentloaded;
- _loc1_.percentTxt.selectable = false;
- };
- JCPreloaderClass.prototype.drawRectangle = function(x1, x2, y1, y2, lineCol, fillCol, trans, shallWeFill)
- {
- var _loc1_ = this;
- var _loc2_ = y1;
- var _loc3_ = x1;
- _loc1_.lineStyle(_loc1_.lineWidth,lineCol);
- if(shallWeFill)
- {
- _loc1_.beginFill(fillCol,trans);
- }
- _loc1_.moveTo(_loc3_,_loc2_);
- _loc1_.lineTo(x2,_loc2_);
- _loc1_.lineTo(x2,y2);
- _loc1_.lineTo(_loc3_,y2);
- _loc1_.lineTo(_loc3_,_loc2_);
- if(shallWeFill)
- {
- _loc1_.endFill();
- }
- };
- JCPreloaderClass.prototype.getLabel = function()
- {
- return this.fLabel_mc.labelField.text;
- };
- JCPreloaderClass.prototype.setLabel = function(label)
- {
- var _loc1_ = this;
- _loc1_.fLabel_mc.setLabel(label);
- _loc1_.txtFormat();
- _loc1_.arrangeLabel();
- if(Accessibility.isActive())
- {
- Accessibility.sendEvent(_loc1_,0,_loc1_.EVENT_OBJECT_NAMECHANGE);
- }
- };
- JCPreloaderClass.prototype.setClickHandler = function(chng, obj)
- {
- var _loc1_ = this;
- _loc1_.handlerObj = arguments.length >= 2 ? obj : _loc1_._parent;
- _loc1_.clickHandler = chng;
- };
- JCPreloaderClass.prototype.executeCallBack = function()
- {
- var _loc1_ = this;
- _loc1_.handlerObj[_loc1_.clickHandler](_loc1_);
- };
- Object.registerClass("JCPreloaderMC",JCPreloaderClass);
-